<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	$redirect_urls = urlencode($_SERVER['HTTP_REFERER']);
//	sp($_SESSION);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员注册_<?= $web_titles ?></title>
<meta name="Keywords" content="会员注册,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/style.css"/>
<style type="text/css">
	@media screen and (min-width:1200px ) {
		.content{
			max-width: 1200px;
		}
	}
	@media screen and (max-width:1200px ) {
		.content{
			width: 100%;
		}
		.login-box{
			float: none;
			margin: auto;
		}
	}
	@media screen and (max-width:500px ) {
		.login-box{
			width: 90%;
			height: 460px;
		}
		.login-use-btn a{
			display: block;
			margin-bottom: 10px;
		}
		.login-head{
			padding: 0 0 10px;
		}
		.login-bd .login-use-btn .use-btn{
			padding: 0;
			width: 100%;
			text-align: center;
		}
		.login-head .logo{
			margin: auto;
		}
		.login-bd .login_chest{
			width: 70px!important;
		}
		.login-bd .f-login span a{
			display: none;
		}
		.login-bd .login_chest1{
			width: 130px!important;
		}
		body{
			min-width: 100% !important;
		}
	}
	@media screen and (max-width: 375px) {
		.login-bd .login_chest1{
			width: 80px!important;
		}
	}

</style>
</head>
<body>
    <div class="login-wrap">
        <div class="content pb35">
			<? include("_include.login.head.php") ?>
            <div class="login-box">
                				<?php
								
								if($_SESSION['kboy_qq_login'] || $_SESSION['kboy_weibo_login'] ){

								?>

									<div class="title">请绑定中国徒步网</div>

								<?php

										}else{

								?>

									<div class="title">欢迎注册中国徒步网</div>

								<?php

										}

								?>
				<form name="regform" id="regform" method="post" action="regsave.php?action=savephone">
				<input type="hidden" name="redirect_urls" id="redirect_urls" value="<?=$redirect_urls?>" />
                <div class="login-bd pt24">
                	<div class="f-login-hd">
                        <h3 class="p-style">
                            <a href="reg.php" >邮箱注册</a>|<a href="reg_phone.php" class="aa on">手机注册</a>
                        </h3>
                    </div>
                    <div class="f-login-wrap">
                        <div class="f-login-pane current">
		                    <div class="f-login">
		                        <input name="user_phone" id="user_phone" type="text" placeholder="请输入手机号" class="login-input login_mess" value="">
		                    </div>
		                    <p class="phone_text"></p>
		                    <div class="f-login">
		                        <input name="user_phonecode" type="text" class="login-input login_chest1" id="user_phonecode" value="" placeholder="验证码">
		                        <span class="get-yzm"><a href="alert.getphone.php?action=reg" class="phone-yzm" >获取验证码</a>
								</span>
		                    </div>
		                    <p></p>
		                    <div class="f-login">
		                        <input name="user_password" id="user_password" type="password" placeholder="密码" class="login-input login_password" value="">
		                    </div>
		                    <p class="password_text"></p>
		                    <div class="f-login">
		                        <input name="user_repassword" id="user_repassword" type="password" placeholder="重复密码" class="login-input login_password" value="">
		                    </div>
		                    <div class="f-login-bd protocol">
		                        <span class="auto-login"><label><input type="checkbox" name="user_isgree" id="user_isgree" value="1"/>我已阅读并同意<a href="#">《徒步网社区用户注册协议》</a></label></span>
		                    </div>
		                    <div class="login-btn">
								<?php
										if($_SESSION['kboy_qq_login'] || $_SESSION['kboy_weibo_login'] ){
								?>
									<input type="submit" name="reg_btn" class="basic-btn" value="立即绑定" />
								<?php
										}else{
								?>
									<input type="submit" name="reg_btn" class="basic-btn" value="立即注册" />
								<?php
										}
								?>
								<br /><a href="login.php">已有账号？去登录？</a>
							</div>                           
                        </div>
                        
                    </div>
                </div>
				</form>
            </div>         
            <div class="clearfix"></div>
            <div class="recommend-line">
                <div class="line-label">路线推荐</div>
                <div class="line-show">
                    <div class="bd">
                        <ul class="infoList">
						<?php
								$news_sql = "select * from kboy_forum_active order by active_top desc,active_order desc, id desc limit 5";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
									echo "<li><a href=\"activeview.php?newsid=".$news_rs['id']."\" target=\"_blank\">".$news_rs['active_title']."</a></li>";
								}
						?>
                        </ul>
                    </div>
                </div>
                <div class="close"><img src="images/close.png" width="21" height="21" alt=""/></div>
            </div>
        </div>
		<div id="msgcontent">
		</div>
        <!--版权信息-->
		<? include("_include.login.copyright.php") ?>
    </div>
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/login.js"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="js/alert.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		// 刷新验证码
		// 用户名验证
		$("#user_phone").blur(function(){
			$.ajax({ 
				url:'regsave.php', 
				type:'post',
				dataType:'html',
				data:'action=chkuserphone&user_phone=' + $("#user_phone").val() + '&date='+new Date(),
				error: function(){
					layer.msg('Error loading document'); 
				},success: function(msg){
					if(msg == 1){
						$(".phone_text").html("");
					}else{
						$(".phone_text").html(msg);
					}
				} 
			}); 
		});
		
		// 表单提交
		$("#regform").submit(function(){
			var user_phone = $("#user_phone").val();
			var user_phone_rule = /^1[134578]\d{9}$/;
			var user_phonecode = $("#user_phonecode").val();
			var user_password = $("#user_password").val();
			var user_repassword = $("#user_repassword").val();
			var user_isgree = $("#user_isgree").is(":checked");

			
			// 手机号验证
			if(!user_phone_rule.test(user_phone)){
				alert("手机号格式错误！");
				$("#user_phone").focus();
				return false;
			}
			
			// 验证码验证
			if (user_phonecode.replace(/\ /g,"").length<1){
				alert("请正确输入验证码！");
				$("#user_phonecode").focus();
				return false;
			}

			// 密码验证
			if(user_password.replace(/\ /g,"").length<5){
				alert("密码不能少于5位字符！");
				$("#user_password").focus();
				return false;
			}
			if(user_repassword.replace(/\ /g,"").length<5){
				alert("两次密码输入不一致！");
				$("#user_repassword").focus();
				return false;
			}
			if(user_password != user_repassword){
				alert("两次密码输入不一致！");
				$("#user_password").focus();
				return false;
			}
			
			if (!user_isgree){
				alert("请勾选注册协议！");
				return false;
			}
		});
	});
</script>
</body>
</html>
